<template>
	<view :style="theme">
		<view class="content">
			<view class="card" v-for="(item, index) in list" :key="index">
				<view class="f30 c3 flex">
					<u-icon color="#333333" name="map" size="40rpx" />
					<text class="ml10">{{item.venueName}}</text>
				</view>
				<view class="flex mt24">
					<image :src="imgHost + '/default_parking_discounts.png'" class="left"></image>
					<view class="right">
						<view class="f36 c1 fw5">{{item.duration}}小时停车优惠</view>
						<view class="f28 ztColor mt14">{{item.plateNumber}}</view>
					</view>
				</view>
				<view class="f24 c9 mt30">
					领取时间：{{item.createTime }}
				</view>
			</view>
			<u-loadmore v-if="end && list.length >= 10" :status="status" line />
		</view>
		<view v-if="list.length === 0" class="no-order">
			<image :src="imgHost+'/default_nodata.png'"></image>
			<view>暂无记录～</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				page: 1,
				end: false,
				firstQueryTime: '',
				status: 'nomore',
			}
		},
		onShow() {
			this.firstQueryTime = this.$app.firstQueryTime()
			this.list = [];
			this.page = 1;
			this.end = false;
			this.getList()
		},
		methods: {
			jump(url, params, a) {
				this.$app.jump(url, params, a);
			},
			jump2(url, params, a) {
				this.$app.jump2(url, params, a);
			},
			getList() {
				this.$app.ajax({
					data: {
						pagination: {
							firstQueryTime: this.firstQueryTime,
							page: this.page,
							rows: 10
						},
						param: {
							memberId: this.userInfo.id
						}
					},
					api: this.$api.memberPdGetRecord()
				}).then((res) => {
					if (res.errorCode === '000000') {
						if (!res.recordList || res.recordList.length < 10) {
							this.end = true
						}
						if (res.recordList) {
							this.list = this.list.concat(res.recordList)
						}
					}
				}).catch(() => {})
			},
			reachBottom() {
				if (!this.end) {
					this.page += 1;
					this.getList();
				}
			},
			// 触底加载更多数据
			onReachBottom(e) {
				this.reachBottom()
			}

		}

	}
</script>
<style scoped lang="scss">
	.content {
		padding: 20rpx 30rpx;
		box-sizing: border-box
	}

	.card {
		background: #FFFFFF;
		border-radius: 8rpx;
		position: relative;
		padding: 30rpx;
		box-sizing: border-box;
		margin-bottom: 20rpx;
	}


	.left {
		width: 104rpx;
		height: 104rpx;
		border-radius: 8rpx;
		margin-right: 20rpx;
	}

	.right {
		flex: 1;
	}
</style>